#pragma once

#include "fpserialport_global.h"
#include "FpSpDefine.h"
#include "FpSerialPort.h"
#include "FpSerialReciver.h"
#include <QObject>
#include <QSharedPointer>

FP_SERIALPORT_BEGIN

class FPSERIALPORT_EXPORT FpSPCommunicator  : public QObject
{
	Q_OBJECT

public:
	FpSPCommunicator(QObject* parent = nullptr);
	FpSPCommunicator(FpSpCfgData spCfg,QObject *parent = nullptr);
	~FpSPCommunicator();

	bool SetSerialPortConfig(FpSpCfgData spCfg);

	bool Connect();

private:
	FpSerialPort _sp;
	QSharedPointer<FpSerialReciver> _spRec = nullptr;
};

FP_SERIALPORT_END
